package cn.edu.hitsz.core;

import cn.edu.hitsz.conf.LoadConfiguration;

/**
 * RECORD ALL TEH CURRENT FILE DIRECTORY AND FILE NAME STATUS
 * 
 * @author mingchen
 * @date 2015年8月9日
 */
public class WriteStat {
	private static int Max_Files_Per_Dir = LoadConfiguration
			.getIntValueByKey("maxfilesperdir");
	/**
	 * The two parameters set for current file position
	 */
	public static long fileDirHandle;
	public static int fileNameHandle;

	/**
	 * Current directory position [synchronized]
	 * 
	 * @return long 2015年8月9日
	 */
	public synchronized static long getDirStat() {

		if (fileNameHandle <= Max_Files_Per_Dir) {
			return fileDirHandle;
		}
		fileDirHandle += 1;
		return fileDirHandle;
	}

	/**
	 * Current fileName position [synchronized]
	 * 
	 * @return int 2015年8月9日
	 */
	public synchronized static int getNameStat() {
		fileNameHandle += 1;
		return fileNameHandle;
	}


}
